home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
graphics
/
3dvect30.arj
/
FONT.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-11-18
|
11KB
|
451 lines
; font.asm - font and cosmetic screen handling routines
; this basically draws backgound screens/opening menus.
; have you played Red Baron or Aces of the Pacific? It's kind of like that
.386p
jumps
code32 segment para public use32
assume cs:code32, ds:code32, ss:code32
include pmode.inc ; include externals for other modules
include xmode.inc ; just in case we ever want to use them...
include xmouse.inc
include stars.inc
include macros.inc
include 3d.inc
include equ.inc
include font0.inc ; font 0
include font1.inc ; font 0
include font2.inc ; font length tables
public tstring
public string
public initfont
public put_at_top
public number_eax
; display string of font from [esi] to zero byte
; eg db -1
; dw x,y
; db colour,"Hello",0
;
; commands: -1 start new x,y,colour and text
; -2 draw full border starting at x,y to x,y colour offset col
; -3 fill within limits x,y to x,y colour offset col
; -4 draw inside border from x,y to x,y colour offset col
; -5 set lower case
; -6 set upper case
; -7 steel textured box
; -8 repeated bitmap box
;
; fill inside full borders 3 smaller than border
; fill inside full borders 2 smaller than border to make a "lump"
; fill inside "hole" border 2 smaller than hole
newtext equ -1
border equ -2
fillarea equ -3
hole equ -4
lowercase equ -5
uppercase equ -6
steelbox equ -7
repeatbit equ -8
textend equ 0
wcase db 0 ; upper/lower case add
colt dw 0
linecol dw 0
tw1 dw 0
tq2 dw 0
sinewave dw 0 ; sine wave for colour
ltflag dw 0
brflag dw 0
q1 dw 0
w1 dw 0
q2 dw 0
w2 dw 0
tstring:
push esi ; same as string, but does
call string ; it to both sides
call flip_page
pop esi
call string
call flip_page
ret
string:
mov wcase,0 ; default to upper case
cld
lodsb
jmp testcommand
freshtext:
lodsw
mov bx,ax ; x
lodsw
mov cx,ax ; y
mov ah,0
lodsb
mov dx,ax ; colour
textloop:
lodsb ; get character/command
testcommand:
cmp al,0
je txnon
cmp al,newtext ; -1 = 255 = set new x,y,col
je freshtext
cmp al,border ; -2 = outside border
jne n254
call outside
jmp textloop ; ok, i should've used indirect jumps
n254:
cmp al,fillarea ; fine, give me a hassle, like i need it!
jne n253 ; the code is done, i don't want to
call dofill ; change it all now so there!
jmp textloop
n253:
cmp al,hole
jne n252
call inside
jmp textloop
n252:
cmp al,lowercase
jne n251
mov wcase,128
jmp textloop
n251:
cmp al,uppercase
jne n250
mov wcase,0
jmp textloop
n250:
cmp al,steelbox
jne n249
call steeltext
jmp textloop
n249:
cmp al,repeatbit
jne n248
call dobitmapthingy
jmp textloop
n248:
add al,wcase ; include which case
pusha
char ax,bx,cx,dx
popa
movzx edi,ax
add di,di
add bx,fontlength[edi] ; inc to next position
jmp textloop
txnon:
ret
initfont:
push offset font0 ; initialize font0 block
pushw 0
call set_display_font
push offset font1 ; initialize font1 block
pushw 1
call set_display_font
ret
borderd equ 2
borderm equ 9
borderl equ 15
outside:
lodsw ; draw outside box, get q1,w1 q2,w2
mov q1,ax ; q1,w1 is top left, q2,w2 is bot right
lodsw
mov w1,ax
lodsw
mov q2,ax
lodsw
mov w2,ax
lodsw
mov colt,ax
push esi
mov ax,colt
add ax,borderd+1
mov linecol,ax
drawline q1,w1,q1,w2,linecol ; now draw lines, use macros
mov ax,colt
add ax,borderm-1
mov linecol,ax
drawline q1,w1,q2,w1,linecol
mov ax,colt
add ax,borderm+1
mov linecol,ax
drawline q2,w1,q2,w2,linecol
mov ax,colt
add ax,borderd+0
mov linecol,ax
drawline q1,w2,q2,w2,linecol
inc w1 ; bump for middle lines
dec w2
inc q1
dec q2
mov ax,colt ; draw middle lines
add ax,borderl-1
mov linecol,ax
drawline q1,w1,q1,w2,linecol
mov ax,colt
add ax,borderl-2
mov linecol,ax
drawline q1,w1,q2,w1,linecol
mov ax,colt
add ax,borderl-2
mov linecol,ax
drawline q2,w1,q2,w2,linecol
mov ax,colt
add ax,borderm-1
mov linecol,ax
drawline q1,w2,q2,w2,linecol
inc w1 ; bump for inside lines
dec w2
inc q1
dec q2
mov ax,colt
add ax,borderd+2
mov linecol,ax
drawline q1,w1,q1,w2,linecol ; draw inner lines
mov ax,colt
add ax,borderd+1
mov linecol,ax
drawline q1,w1,q2,w1,linecol
mov ax,colt
add ax,borderd+0
mov linecol,ax
drawline q2,w1,q2,w2,linecol
mov ax,colt
add ax,borderl-2
mov linecol,ax
drawline q1,w2,q2,w2,linecol
pop esi
ret
dofill:
lodsw ; fill box, get q1,w1 q2,w2
mov q1,ax ; q1,w1 is top left, q2,w2 is bot right
lodsw
mov w1,ax
lodsw
mov q2,ax
lodsw
mov w2,ax
lodsw
cmp ax,0
jne df_ncol
mov ax,background ; if colour 0, get background colour
df_ncol:
mov colt,ax
push esi
block q1,w1,q2,w2,colt
pop esi
ret
inside:
lodsw ; draw inside box, get q1,w1 q2,w2
mov q1,ax ; q1,w1 is top left, q2,w2 is bot right
lodsw
mov w1,ax
lodsw
mov q2,ax
lodsw
mov w2,ax
lodsw
mov colt,ax
push esi
mov ax,colt
add ax,borderm+1
mov linecol,ax
drawline q1,w1,q1,w2,linecol ; now draw lines, use macros
mov ax,colt
add ax,borderd-1
mov linecol,ax
drawline q1,w1,q2,w1,linecol
mov ax,colt
add ax,borderd+1
mov linecol,ax
drawline q2,w1,q2,w2,linecol
mov ax,colt
add ax,borderm+2
mov linecol,ax
drawline q1,w2,q2,w2,linecol
inc w1 ; bump for inside lines
dec w2
inc q1
dec q2
mov ax,colt
add ax,borderm+3
mov linecol,ax
drawline q1,w1,q1,w2,linecol ; now draw lines, use macros
mov ax,colt
add ax,borderd+1
mov linecol,ax
drawline q1,w1,q2,w1,linecol
mov ax,colt
add ax,borderd+2
mov linecol,ax
drawline q2,w1,q2,w2,linecol
mov ax,colt
add ax,borderl
mov linecol,ax
drawline q1,w2,q2,w2,linecol
pop esi
ret
simplesine dw 9,10,11,12,13,14,15,15
dw 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,1,2,3,4,5,6,7,8
steeltext:
mov ltflag,0 ; make steel textured box (sin wave)
mov brflag,0
mov sinewave,0
lodsw
mov q1,ax
mov q2,ax
lodsw
mov tw1,ax
lodsw
mov tq2,ax
lodsw
mov w1,ax
mov w2,ax
lodsw
mov linecol,ax
lodsw
mov colt,ax
steel_loop:
mov cx,colt
add sinewave,cx
movzx edi,sinewave
shr di,8
and di,32*2-2
mov ax,simplesine[edi]
add ax,linecol
mov di,ax
drawline q1,w1,q2,w2,di
mov ax,ltflag
cmp ax,0
jne st_doside
dec w1
mov ax,w1
cmp ax,tw1
jne st_dopt2
mov ltflag,1
jmp st_dopt2
st_doside:
inc q1
st_dopt2:
mov ax,brflag
cmp ax,1
je st_doup
inc q2
mov ax,q2
cmp ax,tq2
jne st_chkout
mov brflag,1
st_chkout:
mov ax,q1
cmp ax,tq2
jna steel_loop
ret
st_doup:
dec w2
jmp st_chkout
dobitmapthingy:
push esi
lodsd ; do repeat bitmap
push eax ; push bitmap offset (location of bitmap)
lodsw ; get x1,y1,x2,y2
push ax
lodsw
push ax
lodsw
push ax
lodsw
push ax
call repeat_bitmap
pop esi
add esi,2+2+2+2+4 ; add for next text instruction
ret
number_eax dd 0
hexs db "0123456789ABCDEF"
top_number db -3
dw 100,12,220,32,3
db -1
dw 107,20
db 13
db "EAX="
number db "00000000",0
put_at_top:
pushad
mov eax,number_eax
mov esi,7
call set_hex
call set_hex
call set_hex
call set_hex
call set_hex
call set_hex
call set_hex
call set_hex
mov esi, o top_number
call string
popad
ret
set_hex:
mov di,ax
and edi,0fh
mov bl,hexs[edi]
mov number[esi],bl
shr eax,4
dec si
ret
code32 ends
end